package com.shanxia.codec.enums;

import java.util.Objects;

/**
 * 充电启动失败编码
 */
public enum ChargeStartFailEnum {

    SUCCESS(0, "充电启动成功"),
    CC1_NOTCONNECT(1, "CC1 未连接"),
    ISOLATION_CHECK_OVERTIME(2, "绝缘检测超时"),
    ISOLATION_CHECK_EXCEPTION(3, "绝缘检测异常"),
    CHARGING_STOP_SERVICE(4, "充电机暂停服务"),
    CHARGING_SYSTEM_FAULT_CANTCHARGE(5, "充电机系统故障,不能充电"),
    SUPPORT_BATT_NOTMATCH(6, "辅电不匹配"),
    SUPPORT_BATT_STARTFAIL(7, "辅电开启失败"),
    CHARGING_START_OVERTIME(9, "充电启动超时"),
    BMS_COMMU_SHAKE_FAIL(10, "BMS 通信握手失败"),
    BMS_COMMU_SET_FAIL(11, "BMS 通信配置失败"),
    BMS_SETTING_EXCEPTION(12, "BMS 参数异常"),
    PILE_CHARGING_CANT_RESTART(13, "桩正在充电中，不能再启动"),
    LOCAL_PATTERN_CANT_CHARGE(14, "本地模式，不能启动充电"),
    START_UNKNOWN_ERROR(15, "启动未知错误"),
    PILE_ORDERED_START_FAIL(16, "桩已预约，启动失败"),
    PILENUM_NOT_EXIST(17, "预约枪口号不存在的"),
    ORDER_ACCOUNT_NOTSAME(18, "预约账户不一致"),
    V19(19, "保留"),
    PARAM_ERROR1(20, "参数错误1"),
    // 以下为交流充电桩信息
    CHARGING_SYSTEM_FAULT(100001, "充电机系统故障"),
    CAR_READY_OVERTIME(100002, "车辆准备就绪超时"),
    AC_PILE_CHARGING_CANT_RESTART(100003, "桩正在充电中，不能再启动"),
    AC_LOCAL_PATTERN_CANT_CHARGE(100004, "本地模式，不能启动充电"),
    WRONG_PILENUM(100005, "枪口号不对"),
    UNKNOWN(99, "未知");

    public static ChargeStartFailEnum getByCode(int code) {
        for (ChargeStartFailEnum enums : ChargeStartFailEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return ChargeStartFailEnum.UNKNOWN;
    }

    ChargeStartFailEnum(int code, String descr) {
        this.code = code;
        this.descr = descr;
    }

    public int code;
    public String descr;
}
